<?php
/**
 * 国家物流【具体发的物流数据】-数据模型
 */

namespace app\common\model;

class ExpressCountry extends BaseModel
{
    //数据表主键
    protected $pk = 'express_country_id';

    protected $insert = ['create_by', 'update_by'];

    protected $update = ['update_time','update_by'];

    /**
     * 状态开启
     */
    const STATUS_Y = 1;
    /**
     * 状态关闭
     */
    const STATUS_N = 0;

    public static $CHANNEL_STATUS = [
        self::STATUS_Y => '是',
        self::STATUS_N => '否',
    ];


    //联表查询【物流报价单】【ExpressCountry::with('quotation')->get()】
    public function quotation()
    {
        return $this->hasMany(ExpressCountryQuotation::class,'express_country_id','express_country_id');
    }


    /**
     * 获取所有物流列表
     * @return ExpressCountry[]
     */
    public static function getAll()
    {
        return static::where("status", static::IS_YES)
            ->order("sort desc")->select();
    }


}
